package com.itany.book.service.impl;

import com.itany.mapper.PressMapper;
import com.itany.pojo.Press;
import com.itany.service.PressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public class PressServiceImpl implements PressService {

    @Autowired
    PressMapper pressMapper;
    /**
     * 不分页查询所有的供应商信息
     *
     * @return
     */
    @Override
    @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
    public List<Press> findAllNoPages() {
        List<Press> presses = pressMapper.selectAll();
        return presses.isEmpty()?null:presses;
    }
}
